package com.whu.waterworks.action;

import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.whu.waterworks.model.Commontype;
import com.whu.waterworks.service.CommontypeService;
/**
 * 得到所有的数据类型
 * @author wangying
 *
 */
public class GetAllCommonType extends ActionSupport{

	/**
	 * 
	 */
	private static final long serialVersionUID = 5353337894920816370L;
	
	private CommontypeService commontypeService;
	
	private List<Commontype> commontypes;

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		
		commontypes = commontypeService.getAll();
		//去掉单位
		/*try {
			if(commontypes!=null && commontypes.size()>0)
			{
				for(int i=0; i<commontypes.size();i++)
				{
					Commontype commontype = commontypes.get(i);
					commontype.setType(commontype.getType().split("\\(")[0]);
					//System.out.println("GetAllCommonType commontype.getType()]="+commontype.getType().split("\\(")[0]);
					commontypes.set(i, commontype);
				}
			}
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}*/
		//System.out.println("GetAllCommonType commontypes.size()="+commontypes.size());
		return super.execute();
	}
	
	public CommontypeService getCommontypeService() {
		return commontypeService;
	}

	public void setCommontypeService(CommontypeService commontypeService) {
		this.commontypeService = commontypeService;
	}

	public List<Commontype> getCommontypes() {
		return commontypes;
	}

	public void setCommontypes(List<Commontype> commontypes) {
		this.commontypes = commontypes;
	}

	
	

}
